#-*- coding: utf-8 -*-

## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


import wx
import wx.aui

import vmenu
import vbherramientas
import areadetrabajo

class VPyragua(wx.Frame):
    '''La ventana principal de Pyragua.'''
    def __init__(self, editor, parent, id=-1, title="Pyragua", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):

        self.editor = editor
        self.app = wx.App()
        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        # le decimos al FrameManager que administre esta ventana
        self._mgr = wx.aui.AuiManager()
        self._mgr.SetManagedWindow(self)

        # TODO: Definir el ícono de la ventana

        # La barra de menús
        menu = vmenu.VMenu(self)
        self.SetMenuBar(menu)

        # La barra de Estado
        self.barradeestado = self.CreateStatusBar(3)
        self.barradeestado.SetStatusWidths([-5, -2, -2])

        # TODO: Texto inicial

        # La barra de Herramientas
        self.barraherramientas = vbherramientas.VBHerramientas(self)
        pane = wx.aui.AuiPaneInfo().Name("tb1").Caption("Barra Principal")
        pane.Top().LeftDockable(False).RightDockable(False)
        self.SetToolBar(self.barraherramientas)

        self.at = areadetrabajo.AreaDeTrabajo(self)

    def cerrar(self, event):
        print "Cerrando"
        self.editor.cerrar()
        self.Destroy()

    def loop(self):
        self.Show()
        self.app.MainLoop()

    def nuevo(self, event):
	print "Nuevo archivo"
	self.at.nuevo_archivo()

    def abrir(self, event):
	'''abrir un archivo en pyragua.'''
	self.at.abrir_archivo()

    def guardar(self, event):
	'''guardar un archivo en pyragua'''
	self.at.guardar()

    def guardar_como(self, event):
	'''guardar un archivo en pyragua(especificando nombre y ruta)'''
	self.at.guardar_como()




        
if __name__ == '__main__':
    app = wx.App()
    w = VPyragua(None, None)
    w.Show()
    app.MainLoop()
